<template>
  <div style="margin-top: 30px;">
    <el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="100px" height="1000px">
      <el-row gutter="1">
        <el-col :span="12">
          <el-form-item label="姓名" prop="name">
            <el-input v-model="formData.name" placeholder="请输入姓名" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="手机号码" prop="mobile">
                <el-input v-model="formData.mobile" placeholder="请输入手机号码" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="出生日期" prop="birthday">
            <el-date-picker v-model="formData.birthday" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
                  :style="{width: '100%'}" 
                  placeholder="请选择日期选择" clearable>
            </el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :span="12">
           <el-form-item label="性别" prop="sex">
                <el-radio-group v-model="formData.sex" >
                  <el-radio v-for="item in dict.type.sex" :key="item.value" :label="item.value">
                    {{ item.label }}
                  </el-radio>
                </el-radio-group>
            </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="会员卡号" prop="userNo" v-if="formData.userNo!== null && formData.userNo!== ''">
                <el-input v-model="formData.userNo" placeholder="请输入会员号" disabled clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="车牌号" prop="carNo">
                <el-input v-model="formData.carNo" placeholder="请输入车牌号" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="备注信息" prop="description">
                <el-input v-model="formData.description" placeholder="请输入备注信息" disabled clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
      </el-row>

      <el-row style="margin-top: 60px;" gutter="1">
        <el-col :span="6">
          <el-form-item label="卡类型" prop="type" >
            <el-radio-group v-model="form.type" @change="handleRadioChange">
              <el-radio v-for="item in dict.type.tm_coupon_type" :key="item.value" :label="item.value">
                  {{ item.label }}
              </el-radio>
            </el-radio-group>
          </el-form-item>
        </el-col>
      </el-row>

        <el-row :gutter="20">
            <el-col :span="10">
                <el-form-item label="卡项名称" prop="name">
                    <el-input v-model="form.name" placeholder="如:10次xxx卡" />
                </el-form-item>
            </el-col>
            <el-col :span="10">
                <el-form-item label="充值金额" prop="amount">
                    <el-input v-model="form.amount" placeholder="请输充值金额" @input="handleInput"/>
                </el-form-item>
            </el-col>
        </el-row>
        <el-row :gutter="20">
            <el-col :span="10">
                <el-form-item label="赠送金额" prop="giveMoney" v-if="form.type === 'P'">
                    <el-input v-model="form.giveMoney" placeholder="请输入赠送金额" @input="handleInput"/>
                    </el-form-item>
            </el-col>
            <el-col :span="10">
                <el-form-item label="可用金额" prop="usableMoney" v-if="form.type === 'P'">
                    <el-input v-model="form.usableMoney" placeholder="自动计算" disabled/>
                </el-form-item>
            </el-col>
        </el-row>
        <el-row :gutter="20">
            <el-col :span="10">
                <el-form-item label="次数" prop="usableTime" v-if="form.type === 'T'">
                    <el-input v-model="form.usableTime" placeholder="请输入次数"/>
                </el-form-item>
            </el-col>
            <el-col :span="10">
                <el-form-item label="说明" prop="remarks">
                    <el-input v-model="form.remarks"  placeholder="请输入内容" />
                </el-form-item>
            </el-col>
        </el-row>
      

      
      

      <el-form-item size="large">
        <el-button type="primary" @click="submitForm">提交</el-button>
        <el-button @click="resetForm">重置</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
export default {
  components: {},
  props: [],
  dicts: ['sex'],
  data() {
    return {
      formData: {
        id: null,
        mobile: null,
        groupId: null,
        userNo: null,
        avatar: null,
        name: null,
        openId: null,
        idcard: null,
        gradeId: null,
        startTime: null,
        endTime: null,
        balance: null,
        point: null,
        sex: null,
        birthday: null,
        carNo: null,
        source: null,
        password: null,
        salt: null,
        address: null,
        merchantId: null,
        storeId: null,
        isStaff: null,
        createTime: null,
        updateTime: null,
        status: null,
        description: null,
        operator: null,
        field105: undefined,
        field102: undefined,
        field103: undefined,
        field104: undefined,
        field107: undefined,
        field106: undefined,
        field111: undefined,
        field112: undefined,
        field113: undefined,
        field114: undefined,
      },
      rules: {
         name: [
          { required: true, message: "姓名不能为空", trigger: "blur" }
        ],
        mobile: [
          { required: true, message: "手机号码不能为空", trigger: "blur" },
          {
            pattern: /^1[3-9]\d{9}$/,
            message: '手机号码格式错误',
            trigger: 'blur'
          }
        ],
        field105: [{
          required: true,
          message: '请输入单行文本',
          trigger: 'blur'
        }],
        field102: [{
          required: true,
          message: '请输入单行文本',
          trigger: 'blur'
        }],
        field103: [{
          required: true,
          message: '请输入单行文本',
          trigger: 'blur'
        }],
        field104: [{
          required: true,
          message: '请输入单行文本',
          trigger: 'blur'
        }],
        field107: [{
          required: true,
          message: '请输入单行文本',
          trigger: 'blur'
        }],
        field106: [{
          required: true,
          message: '请输入单行文本',
          trigger: 'blur'
        }],
        field111: [{
          required: true,
          message: '请输入单行文本',
          trigger: 'blur'
        }],
        field112: [{
          required: true,
          message: '请输入单行文本',
          trigger: 'blur'
        }],
        field113: [{
          required: true,
          message: '请选择下拉选择',
          trigger: 'change'
        }],
        field114: [{
          required: true,
          message: '请输入单行文本',
          trigger: 'blur'
        }],
      },
      field113Options: [{
        "label": "选项一",
        "value": 1
      }, {
        "label": "选项二",
        "value": 2
      }],
    }
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  methods: {
    submitForm() {
      this.$refs['elForm'].validate(valid => {
        if (!valid) return
        // TODO 提交表单
      })
    },
    resetForm() {
      this.$refs['elForm'].resetFields()
    },
  }
}

</script>
<style>
</style>
